package com.blog.cloud.oss.dynamic.properties;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.Map;

/**
 * 存储配置项
 */
@Getter
@Setter
@ConfigurationProperties(prefix = StorageProperties.PREFIX)
public class StorageProperties {

    public static final String PREFIX = "blog.dynamic.storage";

    /**
     * 是否开启存储
     */
    private boolean enabled;

    /**
     * 默认存储源
     */
    private StorageType primary;


    private Map<String, StorageProperty> sourceName;

    /**
     * 本地配置项
     */
    @NestedConfigurationProperty
    private LocalStorageProperties local;

    @Getter
    @RequiredArgsConstructor
    public enum StorageType {
        /**
         * 本地存储
         */
        LOCAL("local","本地存储"),

        /**
         * 阿里云存储
         */
        ALIYUN("aliyun","阿里云存储"),

        /**
         * 腾讯云存储
         */
        TENCENT("tencent","腾讯云存储"),

        /**
         * 七牛云存储
         */
        QINIU("qiniu","七牛云存储");

        /**
         * 存储名
         */
        private final String name;

        /**
         * 存储描述
         */
        private final String desc;
    }

}
